<!-- html -->
<template>
  <h2 class="h2">v-show，条件渲染，会先加载元素</h2>
  <button class="button1" @click="show">显示图片</button>
  <button class="button1" @click="hide">隐藏图片</button>
  <br>
  <img class="img1" v-bind:src="img1" v-show="isShow">
</template>

<!-- js或ts -->
<script lang="ts">
export default {
  name: 'vshowTest1'
}
</script>

<!-- js或ts -->
<script setup lang="ts">
import { ref } from 'vue'
import img1 from '@/assets/img/测试图片1.jpg'
//数据
let isShow = ref(false)
//方法
function show() {
  isShow.value = true
}
function hide() {
  isShow.value = false
}
</script>

<!-- 样式 -->
<style scoped></style>